﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace CyzFaceBLL.Models
{
    /// <summary>
    /// 单个人脸识别结果实体类
    /// </summary>
    public class ResultSingleModel
    {
        /// <summary>
        /// 人脸Pid
        /// </summary>
        public int Pid { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int Age { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string Gender { get; set; }

        /// <summary>
        /// 人脸位置信息
        /// </summary>
        public Rectangle FaceRectangle { get; set; }
        /// <summary>
        /// 人脸置信度
        /// </summary>
        public float FaceScore { get; set; }
        /// <summary>
        /// 人脸特征值
        /// </summary>
        public float[] EigenValues { get; set; }

        /// <summary>
        /// 身份标识号
        /// </summary>
        public string IDNo { get; set; } = "";
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; } = "";
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; } = "";
    }

    /// <summary>
    /// 人脸识别结果实体类
    /// </summary>
    public class ResultModel
    {
        /// <summary>
        /// 原始图片
        /// </summary>
        public Image OriginalImg { get; set; }
        /// <summary>
        /// 处理过的图片
        /// </summary>
        public Image FinishImg { get; set; }
        /// <summary>
        /// 单个人脸识别结果实体类对像列表
        /// </summary>
        public List<ResultSingleModel> ResultSingleModelList { get; set; }

        /// <summary>
        /// 处理成功与否
        /// </summary>
        public bool Success { get; set; } = false;
        /// <summary>
        /// 处理结果消息
        /// </summary>
        public string Msg { get; set; } = "";

    }

    /// <summary>
    /// 人脸比对结果实体类(1:1)
    /// </summary>
    public class CompareResultModel
    {
        /// <summary>
        /// 源单个人脸识别结果实体类对像
        /// </summary>
        public ResultSingleModel SourceModel { get; set; }
        /// <summary>
        /// 现场单个人脸识别结果实体类对像
        /// </summary>
        public ResultSingleModel TargetModel { get; set; }

        /// <summary>
        /// 阈值
        /// </summary>
        public float Threshold { get; set; } = 0.62f;
        /// <summary>
        /// 两张人脸的相似度
        /// </summary>
        public float Similarity { get; set; } = 0;

        /// <summary>
        /// 处理成功与否
        /// </summary>
        public bool Success { get; set; } = false;
        /// <summary>
        /// 处理结果消息
        /// </summary>
        public string Msg { get; set; } = "";

        /// <summary>
        /// 是否为同一个人
        /// </summary>
        public bool IsSelf
        {
            get
            {
                if (!this.Success)
                {
                    return false;
                }
                return (this.Similarity >= this.Threshold);
            }
        }
    }

    /// <summary>
    /// 人脸授权给第三方系统(平台)的结果实体类
    /// </summary>
    public class AuthorizeResultModel
    {
        /// <summary>
        /// 授权码(注:通过固定不变的源人脸信息生成一一对应的不重复的本授权码)
        /// </summary>
        public string AuthorizeCode { get; set; }
    }

}
